﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Categories.aspx.cs" Inherits="TicketingCompany.Categories" %>

<asp:Content ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
    <asp:ScriptManager runat="server" />
    <asp:GridView ID="GridViewCategories" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" DataKeyNames="CategoryID" 
        DataSourceID="EntityDataSourceCategories" 
        onrowdeleting="GridViewCategories_RowDeleting" 
        onrowupdating="GridViewCategories_RowUpdating">
        <Columns>
            <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
            <asp:CommandField ShowEditButton="true" ShowDeleteButton="true" />
        </Columns>
    </asp:GridView>
    <asp:Label ID="LabelDeleteInfo" Text="" runat="server" ForeColor=Red />
    <br /> 

    <asp:EntityDataSource ID="EntityDataSourceCategories" runat="server" ConnectionString="name=TicketingCompanyEntities"
        DefaultContainerName="TicketingCompanyEntities" EnableDelete="True" EnableFlattening="False"
        EnableInsert="True" EnableUpdate="True" EntitySetName="Categories">
    </asp:EntityDataSource>

    <br />
    <asp:Button ID="ButtonShowCreatePanel" Text="Create Category" runat="server" OnClick="ButtonShowCreatePanel_Click" />
    <asp:Panel ID="PanelCreateCategory" runat="server" Visible="false">
        <asp:TextBox ID="TextBoxCategoryName" runat="server" />
        <asp:Button ID="ButtonCreateCategory" Text="Create" runat="server" OnClick="ButtonCreateCategory_Click" />
        <asp:Label ID="LabelErrorCreate" Text="The Category Name should be between 1 and 50 symbols"
            runat="server" ForeColor="Red" Visible="false" />
    </asp:Panel>
</asp:Content>
